<!-- 字典管理 -->
<template>
    <div class="page-box h100 display-flex czbj">
        <p class="title-label">字典管理</p>

        <div>
            <dxtable :headBtn="headBtn" :dataJson="dataJson" :portUrl="portUrl" :qx="qx" ref="databale"
                sonRouter="addDictionary"></dxtable>
        </div>
    </div>
</template>
<script lang='ts' setup>
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget, dxpost, qurl, hf, transferTimeYMD } from "../../util/index";
import { h, ref, reactive } from "vue";
const props = defineProps({
    pup: { type: String },
});
let headBtn = [];
const databale = ref();
const initeer = () => {
    databale.value.initDataExpose();
};
const lijhera = [
    {
        label: "文本",
        value: 1
    }, {
        label: "图片",
        value: 2
    }, {
        label: "多张图片",
        value: 3
    }, {
        label: "富文本",
        value: 4
    },{
        label: "下拉",
        value: 5
    },{
        label: "多个图文",
        value: 6
    },{
        label: "多个视频",
        value: 7
    },{
        label: "pdf、docx",
        value: 9
    },
]
let dataJson = reactive([{
        title: "id",
        key: "id",
        width:70
    },
{
        title: "字典标签",
        key: "zdkey",
        search: true, // 是否在搜索栏展示
    },

    {
        title: "字典描述",
        key: "sxname",
        search: true, // 是否在搜索栏展示
    },
    {
        title: "字段类型",
        key: "type",
        type: "select",
        options: [
            {
                label:"全部",
                value:""
            },
            ...lijhera
        ],
        search: true, // 是否在搜索栏展示
        render(row, index) {
            return lijhera.filter(a => a.value == row.type)[0].label
        },
    }, {
        title: "字段内容",
        key: "text",
        render(row, index) {
            if(row.type==1){
                return row.text
            }
            if(row.type==2){
                return h('img',{src:row.text,class:"dsfdsytyt"})
            }
            if(row.type==3){
                return '多张图片'
            }
            if(row.type==4){
                return '富文本'
            }
            if(row.type==5){
                return '下拉类型'
            }
        },
    },
    {
        title: "排序",
        width: 100,
        render(row) {
            row.databaseName = "dxDictionarymanagement";
            return h(sort, {
                row,
                onCallBack: () => {
                    initeer();
                },
            });
        },
    },
    {
        title: "创建时间",
        key: "addTime",
        width: "200",
        type: "daterange",
    },
]);
let portUrl = "dxgjAdmin/dxDictionarymanagement?roleId="+localStorage.id;
const qx = {
    DeletePermissionID: "DictionaryManagementdel", //删除
    EditPermissionIdentifier: "DictionaryManagementbj", // 编辑
    NewPermissionIdentifier: "DictionaryManagementxz", // 新建
    ViewPermissionID: "DictionaryManagementck", // 查看
};



</script>


